﻿@{
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}


@section scripts{
    <script src="~/assets/js/common.js"></script>
    <script src="~/assets/js/jquery-1.10.2.js"></script>
    <script src="~/assets/js/jquery-1.4.4.min.js"></script>
    <script src="~/assets/js/jquery-ui-1.10.3.custom.js"></script>
    <script src="~/assets/js/backbone-min.js"></script>
    <script src="~/assets/js/handlebars-v2.0.0.js"></script>
    <script src="~/assets/js/jquery.binddata.js"></script>
    <script src="~/assets/js/jquery.validate.js"></script>
    <script src="~/assets/js/json2.js" type="text/javascript"></script>
    <script src="~/assets/js/jquery-1.10.2.js" type="text/javascript" charset="utf-8"></script>
    <script src="~/assets/js/jquery.serializejson.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        var baseView = Backbone.View.extend({

            reset: function () {
                this.model = {
                    templatesUrl: null,
                    fileType: null,
                    fileId: null,
                    listData: { CurrentPage: 1, ItemsPerPage: 50, Items: [] }
                };
            },

            model: null,

            tagName: 'div',

            events: {
                'click a[cmd=page]': 'pageUpdate',
                'click button[cmd=delete]': 'deleteItem',
                'click button[cmd=upload]': 'uploadFile',
                'click button[cmd=save]': 'saveData'
            },

            initialize: function () {
                this.reset();
                this.template = Handlebars.compile($('#templates_' + this.model.fileType).html());
            },

            render: function () {
                this.$el.html(this.template(this.model));
                return this;
            },

            query: function () {
                var self = this;
                var fileId = this.model.fileId;
                var pageIndex = this.model.listData.CurrentPage;
                var pageSize = this.model.listData.ItemsPerPage;
                return $.postJson("/Import/Query", { fileId: fileId, pageIndex: pageIndex, pageSize: pageSize }).done(function (data) {
                    self.model.listData = _.extend(self.model.listData, data.data);
                    self.render();
                    dispalyLoad();
                });
            },

            pageUpdate: function (e) {
                e.preventDefault();
                var page = $(e.target).attr('arg');
                if (page) {
                    page = parseInt(page);
                    this.model.listData.CurrentPage = page;
                    this.query();
                }
                return;
            },

            deleteItem: function (e) {
                e.preventDefault();
                var self = this;
                var fileId = this.model.fileId;
                var id = $(e.target).attr('arg');
                $('#common-dialog-txt').text("您确认要删除当前行？")
                $('#common-dialog').dialog({
                    title: "删除确认",
                    width: 320,
                    height: 180,
                    modal: true,
                    buttons: {
                        '确定': function () {
                            $.postJson("/Import/Delete", { fileId: fileId, id: id }).done(function (data) {
                                $('#common-dialog').dialog('close');
                                if (data.code == 0) {
                                    self.query();
                                    layer.msg("删除成功", { icon: 1, time: 1500 });
                                } else {
                                    messageManager.alert(data.msg);
                                }
                            });
                        },
                        '取消': function () {
                            $('#common-dialog').dialog('close');
                        }
                    }
                });
            },

            uploadFile: function (e) {
                //1.上传
                //2.错误
                //3.没错误接收fileId
                //4.根据fileId拉取数据
                Load();
                var self = this;
                var fnId = "fn_" + (new Date()).getTime().toString();
                var fnHandler = setTimeout(function () {
                    var f = window[fnId];
                    if (f) { f(); }
                }, 60 * 20000);
                window[fnId] = function (r) {
                    console.log(r);
                    delete window[fnId];
                    clearTimeout(fnHandler);

                    if (!r) {
                        messageManager.alert("请求超时！");
                        dispalyLoad();
                        return;
                    }
                    if (r.message) {
                        messageManager.alert(r.message);
                        dispalyLoad();
                        return;
                    }

                    self.model.fileId = r.fileId;
                    self.query();
                };
                var $form = $(e.target).closest("form");
                var url = $form.attr("_action");
                url = url.replace("=?", "=" + fnId);
                $form.attr("action", url);
                $form.submit();
            },

            saveData: function (e) {

                e.preventDefault();
                e.stopPropagation();
                if (!this.model.listData.Items.length) {
                    messageManager.alert("当前没有要导入的数据！");
                    return;
                }
                //========================
                var isSuccess = true;
                var RowNumber = "";
                $.each(this.model.listData.Items, function (x, y) {
                    if (y.IsError) {
                        isSuccess = false;
                        RowNumber += "（" + eval(x + 1) + "） ";
                    }
                });
                if (!isSuccess) {
                    $('#common-dialog-txt').text("您导入的数据列表在第" + RowNumber + "行还有错误信息，请在excel中处理后重新导入，或者在本列表中删除错误数据再保存！")
                    $('#common-dialog').dialog({
                        title: "无法保存 X﹏X ",
                        width: 390,
                        height: 250,
                        modal: true,
                        buttons: {
                            '确定': function () {
                                $('#common-dialog').dialog('close');
                            }
                        }
                    });
                    return;
                }
                //=====================

                var self = this;
                var fileId = this.model.fileId;
                var id = $(e.target).attr('arg');
                $('#common-dialog-txt').text("您确认要导入当前数据？")
                $('#common-dialog').dialog({
                    title: "确认",
                    width: 320,
                    height: 180,
                    modal: true,
                    buttons: {
                        '确定': function () {
                            Load();
                            $.postJson("/Import/Save", { fileId: fileId }).done(function (data) {
                                $('#common-dialog').dialog('close');
                                if (data.code == 0) {
                                    self.query();
                                    layer.msg("导入成功", { icon: 1, time: 1500 });
                                } else {
                                    messageManager.alert(data.msg);
                                }
                                dispalyLoad();
                            });
                        },
                        '取消': function () {
                            $('#common-dialog').dialog('close');
                        }
                    }
                });
            }
        });

        var View_goods = baseView.extend({
            reset: function () {
                baseView.prototype.reset.apply(this, arguments);
                this.model.fileType = "goods";
                this.model.templatesUrl = "/Excels/Sample/商品导入模版.xlsx";
            }
        });
        var View_customer = baseView.extend({
            reset: function () {
                baseView.prototype.reset.apply(this, arguments);
                this.model.fileType = "customer";
                this.model.templatesUrl = "/Excels/Sample/客户导入模版.xlsx";
            }
        });
        var View_item = baseView.extend({
            reset: function () {
                baseView.prototype.reset.apply(this, arguments);
                this.model.fileType = "item";
                this.model.templatesUrl = "/Excels/Sample/项目导入模版.xlsx";
            }
        });
        var View_supplier = baseView.extend({
            reset: function () {
                baseView.prototype.reset.apply(this, arguments);
                this.model.fileType = "supplier";
                this.model.templatesUrl = "/Excels/Sample/供应商导入模版.xlsx";
            }
        });

        var v_goods = new View_goods();
        var v_customer = new View_customer();
        var v_item = new View_item();
        var v_supplier = new View_supplier();

        //第三方维修单
        var View_billextsheet = baseView.extend({
            reset: function () {
                baseView.prototype.reset.apply(this, arguments);
                this.model.fileType = "billextsheet";
                this.model.templatesUrl = "/Excels/Sample/第三方维修单导入模板.xlsx";
            }
        });
        var v_billextsheet = new View_billextsheet();

        $(document).ready(function () {
            resize();
        });
        $(window).resize(function () {
            resize();
        })
    </script>
    <script type="text/javascript">
        $(function () {
            var ViewCaches = {};
            $(".e-page-title").on("click", "a.e-btn:not(.active)", function (e) {
                e.preventDefault();
                var $this = $(this);
                $this.parent().find("a.e-btn.active").removeClass("active");
                $this.addClass("active");
                var type = $this.attr("data-type");
                for (var v in ViewCaches) {
                    ViewCaches[v].undelegateEvents();
                }
                var view = ViewCaches[type];
                if (!view) {
                    view = window["v_" + type];
                    ViewCaches[type] = view;
                }
                view.undelegateEvents();
                view.delegateEvents();
                view.setElement($("#main_box"));
                view.reset();
                view.query();
            }).find("a.e-btn:not(.active):first").trigger("click");
        });
    </script>
}

<div class="e-page-title clearfix margin-0 e-hei  s-e-page-title">
    <h2 class="e-clborder">资料导入</h2>
    <a href="#" class="e-btn page-title-tag s-page-title-tag" data-type="goods">商品导入</a>
    <a href="#" class="e-btn page-title-tag s-page-title-tag" data-type="customer">客户导入</a>
    <a href="#" class="e-btn page-title-tag s-page-title-tag" data-type="item">项目导入</a>
    <a href="#" class="e-btn page-title-tag s-page-title-tag" data-type="supplier">供应商导入</a>
    <a href="#" class="e-btn page-title-tag s-page-title-tag" data-type="billextsheet">第三方维修单导入</a>
</div>
<div class="e-mainfun-content">
    <div class="h-100per e-mainfun-holder">
        <div class="e-pos-r h-100per">
            <div id="main_box" class="e-box e-mainfun w-100per h-100per margin-0 e-ph" style="">

                <!--第三方维修单-->
                <script type="text/x-handlebars-template" id="templates_billextsheet">
                    <div class="e-box-content">
                        <form class="clearfix e-form e-flat-form" method="post" enctype="multipart/form-data" _action="/Import/Upload?type={{fileType}}&cb=?" target="uploadIframe">
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <a href="{{templatesUrl}}" class="btn green-btn btn-warning">请下载导入模板</a>
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <input type="file" title="请选择Excel文件导入" name="file" />
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="upload">上传</button>
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="save">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="e-box-content e-xh-main e-auto">
                        <table class="e-table e-border-top  s-e-table">
                            <thead>
                                <tr class="e-stripe-even ">
                                    <th width="70px">序号</th>
                                    <th width="120px">开单日期</th>
                                    <th width="120px">完工日期 </th>
                                    <th width="80px">结算日期 </th>
                                    <th width="100px">单号 </th>
                                    <th width="100px">接车人 </th>
                                    <th width="120px">结算状态 </th>
                                    <th width="100px">车牌号 </th>
                                    <th width="100px">车型 </th>
                                    <th width="100px">开单时里程 </th>
                                    <th width="100px">VIN </th>
                                    <th width="120px">发动机号 </th>
                                    <th width="120px">客户名称 </th>
                                    <th width="100px">联系手机 </th>
                                    <th width="120px">应收金额 </th>
                                    <th width="100px">实收金额 </th>
                                    <th width="100px">挂账金额 </th>
                                    <th width="100px">项目名称 </th>
                                    <th width="100px">商品名称 </th>
                                    <th width="100px">工时数量 </th>
                                    <th width="100px">金额 </th>
                                    <th width="100px">施工人员 </th>
                                    <th width="100px">销售人员 </th>
                                    <th width="100px">备注 </th>
                                </tr>
                            </thead>
                            <tbody>
                                {{#each listData.Items}}
                                <tr>
                                    <td>{{pageNum @@index ../listData.CurrentPage ../listData.ItemsPerPage }}  </td>
                                    <td class="e-tal-l">{{datetime BillDate yyyy-MM-dd}}</td>
                                    <td class="e-tal-l">{{datetime FinishedDate yyyy-MM-dd}}</td>
                                    <td class="e-tal-l">{{datetime CheckoutDate yyyy-MM-dd}}</td>
                                    <td class="e-tal-r">{{BillCode}}</td>
                                    <td class="e-tal-l">{{PickName}}</td>
                                    <td class="e-tal-r">{{CheckoutState}}</td>
                                    <td class="e-tal-r">{{PlateNumber}}</td>
                                    <td class="e-tal-r">{{CarModel}}</td>
                                    <td class="e-tal-l">{{CurrentMileage}}</td>
                                    <td class="e-tal-l">{{VIN}}</td>
                                    <td class="e-tal-l">{{EngineCode}}</td>
                                    <td class="e-tal-l">{{CustomerName}}</td>
                                    <td class="e-tal-l">{{MobilePhone}}</td>
                                    <td class="e-tal-l">{{AmountMoney}}</td>
                                    <td class="e-tal-l">{{CheckoutMoney}}</td>
                                    <td class="e-tal-l">{{StayInMoney}}</td>
                                    <td class="e-tal-l">{{ItemName}}</td>
                                    <td class="e-tal-l">{{GoodsName}}</td>
                                    <td class="e-tal-l">{{SaleQty}}</td>
                                    <td class="e-tal-l">{{SaleMoney}}</td>
                                    <td class="e-tal-l">{{Worker}}</td>
                                    <td class="e-tal-l">{{SaleMan}}</td>
                                    <td class="e-tal-l">{{Comment}}</td>
                                    {{#if IsError}}
                                    <td><span style='color:red'>错误</span></td>
                                    {{else}}
                                    <td><span style='color:green'>通过</span></td>
                                    {{/if}}
                                    <td class="e-tal-l"><span style='color:red'>{{ErrorMsg}}</span></td>
                                    <td>
                                        <ul class="e-list-tool">
                                            <li class="tool-li">
                                                <span class="tool-item">
                                                    <span class="e-tag-name user-edit">
                                                        <button arg="{{ID}}" class="tool-item btn green-btn mini btn-danger" cmd="delete">删除</button>
                                                    </span>
                                                </span>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                {{else}}
                                <tr>
                                    <td colspan="16">暂无数据 </td>
                                </tr>
                                {{/each}}
                            </tbody>
                        </table>
                        <div>
                            {{pager listData.CurrentPage listData.TotalItems listData.ItemsPerPage}}
                        </div>
                    </div>
                </script>

                <script type="text/x-handlebars-template" id="templates_goods">
                    <div class="e-box-content">
                        <form class="clearfix e-form e-flat-form" method="post" enctype="multipart/form-data" _action="/Import/Upload?type={{fileType}}&cb=?" target="uploadIframe">
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <a href="{{templatesUrl}}" class="btn green-btn btn-warning">请下载导入模板</a>
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <input type="file" title="请选择Excel文件导入" name="file" />
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="upload">上传</button>
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="save">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="e-box-content e-xh-main e-auto">
                        <table class="e-table e-border-top  s-e-table">
                            <thead>
                                <tr class="e-stripe-even ">
                                    <th width="70px">序号</th>
                                    <th width="120px">商品编码</th>
                                    <th width="120px">商品名称 </th>
                                    <th width="80px">单位 </th>
                                    <th width="100px">期初库存 </th>
                                    <th width="100px">仓库 </th>
                                    <th width="120px">期初成本价 </th>
                                    <th width="100px">销售单价 </th>
                                    <th width="100px">安全库存 </th>
                                    <th width="100px">品牌 </th>
                                    <th width="100px">规格 </th>
                                    <th width="120px">适用车牌号 </th>
                                    <th width="120px">产地 </th>
                                    <th width="100px">货位 </th>
                                    <th width="120px">自定义分类 </th>
                                    <th width="100px">校验 </th>
                                    <th width="100px">错误信息 </th>
                                    <th width="100px">操作 </th>
                                </tr>
                            </thead>
                            <tbody>
                                {{#each listData.Items}}
                                    <tr>
                                        <td>{{pageNum @@index ../listData.CurrentPage ../listData.ItemsPerPage }}  </td>
                                        <td class="e-tal-l">{{GoodsCode}}</td>
                                        <td class="e-tal-l">{{GoodsName}}</td>
                                        <td>{{Unit}}</td>
                                        <td class="e-tal-r">{{InitInventory}}</td>
                                        <td class="e-tal-l">{{StorageName}}</td>
                                        <td class="e-tal-r">{{InitCostPrice}}</td>
                                        <td class="e-tal-r">{{SalePrice}}</td>
                                        <td class="e-tal-r">{{SafeQty}}</td>
                                        <td class="e-tal-l">{{Brand}}</td>
                                        <td class="e-tal-l">{{Spec}}</td>
                                        <td class="e-tal-l">{{MatchPlateNumber}}</td>
                                        <td class="e-tal-l">{{Origin}}</td>
                                        <td class="e-tal-l">{{Location}}</td>
                                        <td class="e-tal-l">{{CategoryName}}</td>
                                        {{#if IsError}}
                                        <td><span style='color:red'>错误</span></td>
                                        {{else}}
                                        <td><span style='color:green'>通过</span></td>
                                        {{/if}}
                                        <td class="e-tal-l"><span style='color:red'>{{ErrorMsg}}</span></td>
                                        <td>
                                            <ul class="e-list-tool">
                                                <li class="tool-li">
                                                    <span class="tool-item">
                                                        <span class="e-tag-name user-edit">
                                                            <button arg="{{ID}}" class="tool-item btn green-btn mini btn-danger" cmd="delete">删除</button>
                                                        </span>
                                                    </span>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                {{else}}
                                    <tr>
                                        <td colspan="16">暂无数据 </td>
                                    </tr>
                                {{/each}}
                            </tbody>
                        </table>
                        <div>
                            {{pager listData.CurrentPage listData.TotalItems listData.ItemsPerPage}}
                        </div>
                    </div>
                </script>
                <script type="text/x-handlebars-template" id="templates_customer">
                    <div class="e-box-content">
                        <form class="clearfix e-form e-flat-form" method="post" enctype="multipart/form-data" _action="/Import/Upload?type={{fileType}}&cb=?" target="uploadIframe">
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <a href="{{templatesUrl}}" class="btn green-btn btn-warning">请下载导入模板</a>
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <input type="file" title="请选择Excel文件导入" name="file" />
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="upload">上传</button>
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="save">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="e-box-content e-xh-main e-auto">
                        <table class="e-table e-border-top s-e-table">
                            <thead>
                                <tr class="e-stripe-even ">
                                    <th width="80px">序号</th>
                                    <th width="120px">客户名称</th>
                                    <th width="120px">联系手机 </th>
                                    <th width="100px">车牌号 </th>
                                    <th width="120px">车型 </th>
                                    <th width="100px">车身颜色 </th>
                                    <th width="120px">最新里程 </th>
                                    <th width="120px">客户类型 </th>
                                    <th width="120px">客户单位 </th>
                                    <th width="100px">校验</th>
                                    <th width="120px">错误信息</th>
                                    <th width="100px">操作 </th>
                                </tr>
                            </thead>
                            <tbody>
                                {{#each listData.Items}}
                                    <tr>
                                        <td>{{pageNum @@index ../listData.CurrentPage ../listData.ItemsPerPage }}  </td>
                                        <td class="e-tal-l">{{Name}}</td>
                                        <td class="e-tal-l">{{MobilePhone}}</td>
                                        <td class="e-tal-l">{{PlateNumber}}</td>
                                        <td class="e-tal-l">{{CarModel}}</td>
                                        <td class="e-tal-l">{{Color}}</td>
                                        <td class="e-tal-r">{{Milage}}</td>
                                        <td class="e-tal-l">{{CustomerTag}}</td>
                                        <td class="e-tal-l">{{WorkUnit}}</td>
                                        {{#if IsError}}
                                        <td><span style='color:red'>错误</span></td>
                                        {{else}}
                                        <td><span style='color:green'>通过</span></td>
                                        {{/if}}
                                        <td class="e-tal-l"><span style='color:red'>{{ErrorMsg}}</span></td>
                                        <td>
                                            <ul class="e-list-tool">
                                                <li class="tool-li">
                                                    <span class="tool-item">
                                                        <span class="e-tag-name user-edit">
                                                            <button arg="{{Id}}" class="tool-item btn green-btn mini btn-danger" cmd="delete">删除</button>
                                                        </span>
                                                    </span>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                {{else}}
                                    <tr>
                                        <td colspan="10">暂无数据 </td>
                                    </tr>
                                {{/each}}
                            </tbody>
                        </table>
                        <div>
                            {{pager listData.CurrentPage listData.TotalItems listData.ItemsPerPage}}
                        </div>
                    </div>
                </script>
                <script type="text/x-handlebars-template" id="templates_item">
                    <div class="e-box-content">
                        <form class="clearfix e-form e-flat-form" method="post" enctype="multipart/form-data" _action="/Import/Upload?type={{fileType}}&cb=?" target="uploadIframe">
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <a href="{{templatesUrl}}" class="btn green-btn btn-warning">请下载导入模板</a>
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <input type="file" title="请选择Excel文件导入" name="file" />
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="upload">上传</button>
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="save">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="e-box-content e-xh-main e-auto">
                        <table class="e-table e-border-top s-e-table">
                            <thead>
                                <tr class="e-stripe-even">
                                    <th width="80px">序号</th>
                                    <th width="120px">项目编码 </th>
                                    <th width="120px">项目名称 </th>
                                    <th width="100px">项目分类 </th>
                                    <th width="100px">工时 </th>
                                    <th width="100px">单价 </th>
                                    <th width="100px">校验</th>
                                    <th width="120px">错误信息</th>
                                    <th width="120px">操作 </th>
                                </tr>
                            </thead>
                            <tbody>
                                {{#each listData.Items}}
                                    <tr>
                                        <td>{{pageNum @@index ../listData.CurrentPage ../listData.ItemsPerPage }}  </td>
                                        <td class="e-tal-l">{{ItemCode}}</td>
                                        <td class="e-tal-l">{{ItemName}}</td>
                                        <td class="e-tal-l">{{CategoryName}}</td>
                                        <td class="e-tal-r">{{WorkHours}}</td>
                                        <td class="e-tal-r">{{UnitPrice}}</td>
                                        {{#if IsError}}
                                        <td><span style='color:red'>错误</span></td>
                                        {{else}}
                                        <td><span style='color:green'>通过</span></td>
                                        {{/if}}
                                        <td class="e-tal-l"><span style='color:red'>{{ErrorMsg}}</span></td>
                                        <td>
                                            <ul class="e-list-tool">
                                                <li class="tool-li">
                                                    <span class="tool-item">
                                                        <span class="e-tag-name user-edit">
                                                            <button arg="{{ID}}" class="tool-item btn green-btn mini btn-danger" cmd="delete">删除</button>
                                                        </span>
                                                    </span>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                {{else}}
                                    <tr>
                                        <td colspan="16">暂无数据 </td>
                                    </tr>
                                {{/each}}
                            </tbody>
                        </table>
                        <div>
                            {{pager listData.CurrentPage listData.TotalItems listData.ItemsPerPage}}
                        </div>
                    </div>
                </script>
                <script type="text/x-handlebars-template" id="templates_supplier">
                    <div class="e-box-content">
                        <form class="clearfix e-form e-flat-form" method="post" enctype="multipart/form-data" _action="/Import/Upload?type={{fileType}}&cb=?" target="uploadIframe">
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <a href="{{templatesUrl}}" class="btn green-btn btn-warning">请下载导入模板</a>
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="form-item">
                                    <input type="file" title="请选择Excel文件导入" name="file" />
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="upload">上传</button>
                                </div>
                                <div class="form-item">
                                    <button class="btn green-btn btn-primary" type="button" cmd="save">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="e-box-content e-xh-main e-auto">
                        <table class="e-table e-border-top s-e-table">
                            <thead>
                                <tr class="e-stripe-even">
                                    <th width="80px">序号</th>
                                    <th width="120px">名称 </th>
                                    <th width="120px">联系人 </th>
                                    <th width="120px">联系手机 </th>
                                    <th width="120px">联系电话 </th>
                                    <th width="100px">QQ </th>
                                    <th width="120px">主营业务 </th>
                                    <th width="120px">地址 </th>
                                    <th width="120px">备注 </th>
                                    <th width="100px">校验</th>
                                    <th width="120px">错误信息</th>
                                    <th width="100px">操作 </th>
                                </tr>
                            </thead>
                            <tbody>
                                {{#each listData.Items}}
                                    <tr>
                                        <td>{{pageNum @@index ../listData.CurrentPage ../listData.ItemsPerPage }}  </td>
                                        <td  class="e-tal-l">{{SupplierName}}</td>
                                        <td class="e-tal-l">{{Contactor}}</td>
                                        <td class="e-tal-l">{{MobilePhone}}</td>
                                        <td class="e-tal-l">{{TelePhone}}</td>
                                        <td class="e-tal-l">{{QQ}}</td>
                                        <td class="e-tal-l">{{BizScope}}</td>
                                        <td class="e-tal-l">{{Address}}</td>
                                        <td class="e-tal-l">{{Comment}}</td>
                                        {{#if IsError}}
                                        <td><span style='color:red'>错误</span></td>
                                        {{else}}
                                        <td><span style='color:green'>通过</span></td>
                                        {{/if}}
                                        <td class="e-tal-l"><span style='color:red'>{{ErrorMsg}}</span></td>
                                        <td>
                                            <ul class="e-list-tool">
                                                <li class="tool-li">
                                                    <span class="tool-item">
                                                        <span class="e-tag-name user-edit">
                                                            <button arg="{{ID}}" class="tool-item btn green-btn btn-danger mini" cmd="delete">删除</button>
                                                        </span>
                                                    </span>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                {{else}}
                                    <tr>
                                        <td colspan="9">暂无数据 </td>
                                    </tr>
                                {{/each}}
                            </tbody>
                        </table>
                        <div>
                            {{pager listData.CurrentPage listData.TotalItems listData.ItemsPerPage}}
                        </div>
                    </div>
                </script>
            </div>
        </div>
    </div>
</div>

<iframe src="about:blank" style="display: none; position: absolute; bottom: 0px;" id="uploadIframe" name="uploadIframe"></iframe>